@include('user.head')
	<!-- 公共头部 -->
		<div id="content_person">
			<div class="row">
				<div class="col-xs-3">
					@include("user.uc.navigation")

				</div>
				<div class="col-xs-9">
					<div class="panel panel-default">
					  <div class="panel-heading">
					    <h3 class="panel-title">
					    	用户头像
					    </h3>
					  </div>
					  <div class="panel-body">
						  	<div class="form-group">
						  		<a href="javascript:;" class="file btn btn-primary">上传头像
								    <input type="file" name="imgFile" id="avatarImg">
						  	        <input type="hidden" value="<%$data['avatar']%>" name="avatar" id="avatar">
								</a>
								<span class="face_type">支持JPG、PNG、GIF、BMP格式的图片文件，文件大小小于2M</span>
						  	</div>
						  	<div class="form-group">
						  		<div class="col-xs-12">
						  			<b>当前头像:</b>
						  		</div>
						  	</div>
						  	<div class="form-group">
						  		<div class="col-xs-12">
						  			@if($data['avatar'])
						  			<img id="img" src="<%url('images')%>/<%$data["uid"]%>/others/<%$data["avatar"]%>" class="img_size" width="200" height="200" />
						  			@else
						  			<img id="img" src="<%url('img/default.png')%>" class="img_size" width="200" height="200" />
						  			@endif
						  		</div>
						  	</div>
					    <div class="form-group">
					      <div class="col-xs-12 marginTop30 text-center">
					        <button type="button" id="sub" class="btn btn-primary ">保存修改</button>
					      </div>
					    </div>
					  </div>
					</div>
				</div>
			</div>
		</div>

	<!-- 公共底部 -->
@include('user.footer')
@include('user.common')

	<!-- 公共底部 -->
<script type="text/javascript">
$('#avatarImg').AjaxFileUpload({
	path : "<% url('uc/user/upload') %>",
	onComplete : function(filename){
			$("#avatar").val(filename.filename);
			$("#img").attr("src",'<% url("upload") %>/'+filename.filename);
		}
	});


$("#sub").click(function(){
	var avatar = $("#avatar").val();
	$.post('edit_profile/face', {avatar : avatar}, function(data){
		if(data.success){
			$(".face_type").html('支持JPG、PNG、GIF、BMP格式的图片文件，文件大小小于2M');
			success('', '提交成功');
			setTimeout(function(){
				window.location.reload();
			},2000)
		}
	})
})

</script>

</body>
</html>